<?php

namespace App\Http\Controllers\Frontend;


use App\Logics\OrderLogic;
use App\Logics\UserLogic;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Support\Facades\Redirect;


class ProfileController extends BaseController
{
    // 个人中心
    public function initialize()
    {
        parent::initialize();
    }

    // 个人中心
    public function index()
    {
        $logic = new UserLogic();
        $res   = $logic->info($this->myUser);
        if($res === false){
            return $this->error($logic->getError());
        }

        return $this->success($res);
    }

    // 我的订单
    public function order()
    {
        $logic = new OrderLogic();
        $res   = $logic->lists($this->myUser);
        if($res === false){
            return $this->error($logic->getError());
        }

        return $this->success($res);
    }

    // 下单
    public function addOrder()
    {
        $logic = new OrderLogic();
        $res   = $logic->addOrder($this->myUser);
        if($res === false){
            return $this->error($logic->getError());
        }

        return $this->success($res);
    }


}


